package cn.tangsihai.hrm.service.impl;

import cn.tangsihai.hrm.doc.CourseESDoc;
import cn.tangsihai.hrm.repository.CourseElasticsearchRepository;
import cn.tangsihai.hrm.service.ICourseESService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class CourseESServiceImpl implements ICourseESService {
    @Autowired
    private CourseElasticsearchRepository repository;

    /**
     * 将课程添加到ES中
     * @param esDoc
     */
    @Override
    public void addCourseToES(CourseESDoc esDoc) {
        repository.save(esDoc);
    }

    /**
     * 将课程从ES中删除
     * @param id
     */
    @Override
    public void deleteCourseFromES(Long id) {
        repository.deleteById(id);
    }
}
